<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/24/024
 * Time: 20:12
 */

namespace app\admin\validate;

class CheckDetailValidate extends \think\Validate
{

    const SCENE_ADD = 'add'; //添加
    const SCENE_REMOVE = 'remove'; //删除
    const SCENE_MODIFY = 'modify'; //修改



    protected $rule = [
        'id' => 'require|number',
//        'level' => 'require|between:1,3',
        'c_id' => 'require|number',
        'check_name' => 'require|max:255',
        'deduction_score' => 'require|number',
    ];


    protected $message  = [
        'id.require' => '缺少权限id',
        'id.number' => 'id必须为数字',
//        'level.require' => '请选择权限等级',
//        'level' => '权限等级必须在1-3之间',
        'c_id.require' => '请选择考核细则所属分类',
        'c_id.number' => '考核细则所属分类id必须为数字',
        'check_name.require' => '请输入考核细则名称',
        'name.max' => '考核细则名称不能超过255位',
//        'controller.require' => '请输入控制器名称',
//        'action.require' => '请输入方法名称',
        'deduction_score.require' => '请输入违反该项细则所扣分数',
        'deduction_score.number' => '违反细则所扣分数必须为数字',
    ];

    protected $scene  = [
       self::SCENE_ADD => ['c_id', 'check_name', 'deduction_score'],
       self::SCENE_MODIFY => ['id', 'c_id', 'check_name', 'deduction_score'],
       self::SCENE_REMOVE => ['id'],
    ];

}